﻿using System;
using System.Windows;

namespace CWM.Client.Utils
{
    public partial class Language
    {
        public static string Get(string key)
        {
            return Convert.ToString(Application.Current.FindResource(key));
        }

        public static string TryGet(string key)
        {
            try
            {
                return Convert.ToString(Application.Current.FindResource(key));
            }
            catch (ResourceReferenceKeyNotFoundException)
            {
                return key;
            }
        }

        public static string Get(string key, string arg)
        {
            return string.Format(Get(key),
                 TryGet(arg)
                 );
        }

        public static string Get(string key,string arg1,string arg2)
        {
            return string.Format(Get(key),
                TryGet(arg1),
                TryGet(arg2)
                );
        }

        public static string Get(string key, string arg1, string arg2, string arg3)
        {
            return string.Format(Get(key),
                TryGet(arg1),
                TryGet(arg2),
                TryGet(arg3)
                );
        }

        public string Get(string key,string[] args)
        {
            return string.Format(Get(key), args);
        }


    }
}
